﻿
			<!-- /SAMPLE BOX CONFIGURATION MODAL FORM-->
			<div class="container">
				<div class="row">
					<div id="content" class="col-lg-12">
						<!-- PAGE HEADER-->
						<div class="row">
							<div class="col-sm-12">
								<div class="page-header">
									<!-- STYLER -->

									<!-- /STYLER -->
									<!-- BREADCRUMBS -->
									<ul class="breadcrumb">
										<li>
											<i class="fa fa-home"></i>
											<a href="index.html">Home</a>
										</li>
										<li>
											<a href="#">Form Elements</a>
										</li>
										<li>Forms</li>
									</ul>
									<!-- /BREADCRUMBS -->
									<div class="clearfix">
										<h3 class="content-title pull-left">类型添加</h3>
									</div>
									<div class="description">Form Elements and Features</div>
								</div>
							</div>
						</div>
						<!-- /PAGE HEADER -->
						<!-- FORMS -->
						<div class="row">
							<div class="col-md-12">
								<div class="row">
									<div class="col-md-12">
										<!-- BASIC -->
											<div class="box border green">
											<div class="box-title">
												<h4><i class="fa fa-bars"></i>Form states</h4>
												<div class="tools hidden-xs">
													<a class="config" data-toggle="modal" href="#box-config">
														<i class="fa fa-cog"></i>
													</a>
													<a class="reload" href="javascript:;">
														<i class="fa fa-refresh"></i>
													</a>
													<a class="collapse" href="javascript:;">
														<i class="fa fa-chevron-up"></i>
													</a>
													<a class="remove" href="javascript:;">
														<i class="fa fa-times"></i>
													</a>
												</div>
											</div>
											<div class="box-body big">
												<form action="" method="post"  class="form-horizontal">
												  <div class="form-group">
													<label class="col-sm-3 control-label">标题类型</label>
													<div class="col-sm-6">
													  <input type="text" value="<?php echo $data['name']?>" id="focusedInput" class="form-control" name="name">
													</div>
												  </div>
												  <div class="form-group">
													<label class="col-sm-3 control-label">分类归属</label>
													<div class="col-sm-2 add">
													<?php foreach($cate as $k=>$v){?>
														<select class="form-control list" name="pid">
													  <option  value="0">顶级分类</option>
                                                       <?php foreach($v as $v1){?>
                                                   		<option <?php echo($v1['id']==$k)?'selected':''?> value="<?php echo $v['id']?>"><?php echo $v1['name']?></option>
                                                       <?php }?>
													</select>
													<?php }?>
													</div>
												  </div>

												<div class="form-group">
													<label class="col-sm-3 control-label"></label>
													<div class="col-sm-3">
														<button type="submit" class="btn btn-pink">提交</button>
													</div>
												  </div>

												 </form>
											</div>
										</div>
										<!-- /BASIC -->


								<!-- /BOX -->
							</div>
						</div>
						<!-- /ADVANCED -->

					</div><!-- /CONTENT-->
				</div>
			</div>
		</div>
	</section>
	<!--/PAGE -->
	<!-- JAVASCRIPTS -->
	<!-- Placed at the end of the document so the pages load faster -->
<script src="resources/admin/js/jquery/jquery-2.0.3.min.js"></script>
	<script type="text/javascript">
		$(function(){
			$('.add').on('change','.list',function(){
				$(this).nextAll().remove();
				if ($(this).get(0).selectedIndex==0) {
					return false;
				};

			var id=$(this).val();
			$.ajax({
				url: 'index.php?c=cate&a=add&admin=1&id='+id,
				type: 'get',
				dataType: 'json',
				success:function(json){
					if (json!='') {
					var html='';
						html+='<select class="form-control list">';
						html+='<option value="'+id+'">请选择</option>';
					for (i in json) {

						html+='<option value="'+json[i].id+'">'+json[i].name+'</option>';
					}
						html+='</select>';
					$('.add').append(html);
					 //console.log(json);
					 //alert(1233)
					}
				}
			})
		})
	});


	</script>